package com.hejjon.core.bean;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: cs
 * @date: 2025-02-26 15:35:22
 * @since: 1.0
 */
public class TreeNode<T> {

    private T id;

    private T parentId;

    private List<TreeNode<T>> children;

    public TreeNode() {
    }

    public TreeNode(T id, T parentId) {
        this.id = id;
        this.parentId = parentId;
        this.children = new ArrayList<>();
    }

    public void setId(T id) {
        this.id = id;
    }

    public void setParentId(T parentId) {
        this.parentId = parentId;
    }

    public void setChildren(List<TreeNode<T>> children) {
        this.children = children;
    }

    public T getId() {
        return id;
    }

    public T getParentId() {
        return parentId;
    }

    public List<TreeNode<T>> getChildren() {
        return children;
    }

    public void addChild(TreeNode<T> child) {
        children.add(child);
    }

}
